/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.clinicplus.entity;

import br.com.foxline.clinicplus.enums.GroupProcedure;
import br.com.foxline.clinicplus.enums.TypeProcedure;
import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author roniere
 */
@Entity
public class Procedure implements Serializable{
    
    @Id
    @SequenceGenerator(sequenceName = "seq_procedure", name = "seq_procedure", allocationSize = 1)
    @GeneratedValue(generator = "seq_procedure", strategy = GenerationType.SEQUENCE)
    private Long id;
    private String cod;
    private String name;
    private Integer duration;
    
    @Enumerated(EnumType.STRING)
    private TypeProcedure typeProcedure;
    
    @Enumerated(EnumType.STRING)
    private GroupProcedure groupProcedure;
    
    @OneToMany(cascade= CascadeType.ALL)
    private List<ValueProcedure> valueProcedure;
    
    private Boolean active;
    
    private Boolean appraisal;
    
    @ManyToMany(mappedBy = "procedures")
    private List<TemplateAppraisal> templateAppraisals;
    
    private Boolean aplicadoTodaArcada;
    
    @Lob
    private String recomendacao;

    public String getRecomendacao() {
        return recomendacao;
    }

    public void setRecomendacao(String recomendacao) {
        this.recomendacao = recomendacao;
    }

    
    public Boolean getAplicadoTodaArcada() {
        return aplicadoTodaArcada;
    }

    public void setAplicadoTodaArcada(Boolean aplicadoTodaArcada) {
        this.aplicadoTodaArcada = aplicadoTodaArcada;
    }
    
    

    public Boolean getAppraisal() {
        return appraisal;
    }

    public void setAppraisal(Boolean appraisal) {
        this.appraisal = appraisal;
    }

    public Boolean getActive() {
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public GroupProcedure getGroupProcedure() {
        return groupProcedure;
    }

    public void setGroupProcedure(GroupProcedure groupProcedure) {
        this.groupProcedure = groupProcedure;
    }

    
    
    public TypeProcedure getTypeProcedure() {
        return typeProcedure;
    }

    public void setTypeProcedure(TypeProcedure typeProcedure) {
        this.typeProcedure = typeProcedure;
    }

    public String getCod() {
        return cod;
    }

    public void setCod(String cod) {
        this.cod = cod;
    }

    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<TemplateAppraisal> getTemplateAppraisals() {
        return templateAppraisals;
    }

    public void setTemplateAppraisals(List<TemplateAppraisal> templateAppraisals) {
        this.templateAppraisals = templateAppraisals;
    }

    @Override
    public String toString() {
        return "Procedure{" + "id=" + id + ", cod=" + cod + ", name=" + name + ", duration=" + duration + ", typeProcedure=" + typeProcedure + ", groupProcedure=" + groupProcedure + ", valueProcedure=" + valueProcedure + ", active=" + active + ", appraisal=" + appraisal + ", templateAppraisals=" + templateAppraisals + '}';
    }

    
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Procedure other = (Procedure) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.cod == null) ? (other.cod != null) : !this.cod.equals(other.cod)) {
            return false;
        }
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
            return false;
        }
        if (this.duration != other.duration && (this.duration == null || !this.duration.equals(other.duration))) {
            return false;
        }
        if (this.active != other.active && (this.active == null || !this.active.equals(other.active))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 13 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 13 * hash + (this.cod != null ? this.cod.hashCode() : 0);
        hash = 13 * hash + (this.name != null ? this.name.hashCode() : 0);
        hash = 13 * hash + (this.duration != null ? this.duration.hashCode() : 0);
        hash = 13 * hash + (this.active != null ? this.active.hashCode() : 0);
        return hash;
    }

    
    public List<ValueProcedure> getValueProcedure() {
        return valueProcedure;
    }

    public void setValueProcedure(List<ValueProcedure> valueProcedure) {
        this.valueProcedure = valueProcedure;
    }

}
